package com.imooc.distributedjob;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Description :
 * @Author : YTY
 * @Date : 2021-02-08 07:37
 */

@Slf4j
@Component
public class MyJob {

    @Autowired
    private Process process;

    // initialDelay 延迟启动
    // fixedDelay 固定延迟，前次任务结束到下次任务开始
    // fixedRate 前次任务开始距下次任务开始时间
//    @Scheduled(fixedRate = 3000, initialDelay = 5000)
    // cron参数表达式网站 -> https://cron.qqe2.com/
//    @Scheduled(cron = "0,5 * * * * ?")
//    public void process() throws InterruptedException {
//
//        log.info("process...start");
////        Thread.sleep(2000);
////        log.info("process...end");
//    }

//    @Scheduled(fixedRate = 3000)
//    public void process1() throws InterruptedException {
//
//        log.info("process1...start");
//        process.doProcess1();
//        log.info("process1...end");
//    }

//    @Scheduled(fixedRate = 3000)
//    public void process2() throws InterruptedException {
//
//        log.info("process2...start");
//        Thread.sleep(5000);
//        log.info("process2...end");
//    }

}
